xenstore fires @releaseDomain both when a domain shuts
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 26 Sep 2005 17:49:21 +0000 (18:49 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 26 Sep 2005 17:49:21 +0000 (18:49 +0100)
down and when it eventually dies. xenconsoled now only
relinquishes its handle on a domain when it dies. This
allows us to 'xm console' connect to a crashed domain,
which is very useful!

Signed-off-by: Keir Fraser <keir@xensource.com>
.hgignore
tools/console/daemon/io.c
tools/xenstore/xenstored_domain.c

index d3ab962a7a1b7a10d700ec5b68547c54cd54240e..7dddc93cae39c2d11975cf74a2fecd97b2b67de1 100644 (file)
--- a/.hgignore
+++ b/.hgignore
 ^tools/xenstore/xs_dom0_test$
 ^tools/xenstore/xs_random$
 ^tools/xenstore/xs_stress$
+^tools/xenstore/xs_tdb_dump$
 ^tools/xenstore/xs_test$
 ^tools/xenstore/xs_watch_stress$
 ^tools/xentrace/xenctx$
index cec7f794ce888dc20efc407f9d53aebfa61fe500..e4739d977ceea7ad08170e0662586aa75277c135 100644 (file)
@@ -399,7 +399,7 @@ void enum_domains(void)
 
        while (xc_domain_getinfo(xc, domid, 1, &dominfo) == 1) {
                dom = lookup_domain(dominfo.domid);
-               if (dominfo.dying || dominfo.crashed || dominfo.shutdown) {
+               if (dominfo.dying) {
                        if (dom)
                                shutdown_domain(dom);
                } else {
index 3732781df9a2fac1eb82afd2f42822763793be5d..9ac1b28eef22d7655e1c44fb60b8e780849f5492 100644 (file)
@@ -63,6 +63,8 @@ struct domain
        /* The connection associated with this. */
        struct connection *conn;
 
+       /* Have we noticed that this domain is shutdown? */
+       int shutdown;
 };
 
 static LIST_HEAD(domains);
@@ -222,19 +224,25 @@ static void domain_cleanup(void)
 {
        xc_dominfo_t dominfo;
        struct domain *domain, *tmp;
-       int released = 0;
+       int notify = 0;
 
        list_for_each_entry_safe(domain, tmp, &domains, list) {
                if (xc_domain_getinfo(*xc_handle, domain->domid, 1,
                                      &dominfo) == 1 &&
-                   dominfo.domid == domain->domid &&
-                   !dominfo.dying && !dominfo.crashed && !dominfo.shutdown)
-                       continue;
+                   dominfo.domid == domain->domid) {
+                       if ((dominfo.crashed || dominfo.shutdown)
+                           && !domain->shutdown) {
+                               domain->shutdown = 1;
+                               notify = 1;
+                       }
+                       if (!dominfo.dying)
+                               continue;
+               }
                talloc_free(domain->conn);
-               released++;
+               notify = 1;
        }
 
-       if (released)
+       if (notify)
                fire_watches(NULL, "@releaseDomain", false);
 }
 
@@ -272,6 +280,7 @@ static struct domain *new_domain(void *context, domid_t domid,
        struct domain *domain;
        domain = talloc(context, struct domain);
        domain->port = 0;
+       domain->shutdown = 0;
        domain->domid = domid;
        domain->path = talloc_strdup(domain, path);
        domain->page = xc_map_foreign_range(*xc_handle, domain->domid,